﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="OrderMX.aspx.cs" Inherits="PersonInfo_OrderMX" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title></title>
    <link href="<%= ResolveUrl("~/jquery-easyui-1.2.6/themes/"+Skin+"/easyui.css") %>"
        rel="stylesheet" type="text/css" />
    <link href="../jquery-easyui-1.2.6/themes/icon.css" rel="stylesheet" type="text/css" />
    <script src="../jquery-easyui-1.2.6/jquery-1.7.2.min.js" type="text/javascript"></script>
    <script src="../jquery-easyui-1.2.6/jquery.easyui.min.js" type="text/javascript"></script>
    <script src="../jquery-easyui-1.2.6/locale/easyui-lang-zh_CN.js" type="text/javascript"></script>
    <script src="../Content/js/sysEasyUI.js" type="text/javascript"></script>
    <script type="text/javascript">
        var selectRow;
        $(function () {
            getData(0, 10);
        });
        function getData(pn, pz) {
            $('#grid').datagrid({
                nowrap: false,
                striped: true,
                singleSelect: true,
                collapsible: true,
                url: 'OrderMX.aspx?para=GetList&id=<%=gid %>&startIndex=' + pn,
                sortName: 'ID',
                sortOrder: 'asc',
                idField: 'ID',
                height: 'auto',
                pageList: [5, 10, 20],
                pageSize: 20,
                fitColumns: true,
                columns: [[

                            { field: 'SKU', title: '商品编号', width: 100, sortable: true },
                            { field: 'NAME', title: '商品名称', width: 250 },
                            { field: 'POINTS', title: '商品积分', width: 100 },
                            { field: 'UNITS', title: '兑换数量', width: 100 }
                            
        				]],
                pagination: true,
                rownumbers: true,
                onHeaderContextMenu: function (e, field) {
                    e.preventDefault();
                    if (!$('#tmenu').length) {
                        createColumnMenu("grid");
                    }
                    $('#tmenu').menu('show', {
                        left: e.pageX,
                        top: e.pageY
                    });
                },
                onRowContextMenu: function (e, rowIndex, rowData) {
                    if ($.trim(rowData.ID) == "") {
                        var aa = $("#mm div");
                        for (var a = 0; a < aa.length; a++) {
                            var item = aa[a];
                            if (item.innerText == "修改" || item.innerText == "删除") {
                                $(item).css({ display: "none" });
                                $(item).parent().css({ display: "none" });
                            }
                        }
                    }
                    selectRow = rowData;
                    e.preventDefault();
                    $(this).datagrid('unselectAll');
                    $(this).datagrid('getRows', rowData.code);
                    $('#mm').menu('show', {
                        left: e.pageX,
                        top: e.pageY
                    });
                }
            });
        }

        function Add() {
            openWindow("PersonEdit.aspx?para=add", 600, 400);
        }
        function Update() {
            openWindow("PersonEdit.aspx?para=update&id=" + selectRow.ID, 600, 400);
        }

        function Show() {
            openWindow("IntegralChangeList.aspx?id=" + selectRow.ID, 1000, 450);
        }

        function Delete() {
            $.messager.confirm("提示", "确定要发货吗？", function (r) {
                if (r) {
                    $.ajax({
                        type: "POST",
                        async: false,
                        url: "OrderList.aspx?para=delete&id=" + selectRow.ID,
                        success: function (data) {
                            if (data == "ok") {
                                alert("发货成功");
                                $("#grid").datagrid("reload");
                            }
                            else {
                                alert(data);
                            }
                        }
                    });
                }
            });
        }
        function Delete1() {
            $.messager.confirm("提示", "确定已备货吗？", function (r) {
                if (r) {
                    $.ajax({
                        type: "POST",
                        async: false,
                        url: "OrderList.aspx?para=delete1&id=" + selectRow.ID,
                        success: function (data) {
                            if (data == "ok") {
                                alert("备货成功");
                                $("#grid").datagrid("reload");
                            }
                            else {
                                alert(data);
                            }
                        }
                    });
                }
            });
        }
        function Delete2() {
            $.messager.confirm("提示", "确定已收货吗？", function (r) {
                if (r) {
                    $.ajax({
                        type: "POST",
                        async: false,
                        url: "OrderList.aspx?para=delete2&id=" + selectRow.ID,
                        success: function (data) {
                            if (data == "ok") {
                                alert("收货成功");
                                $("#grid").datagrid("reload");
                            }
                            else {
                                alert(data);
                            }
                        }
                    });
                }
            });
        }
        function btnSearch() {
            $("#Button1 ").click();
        }

       
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div style="display:none;">
        <table>
            <tr>
                <td>
                    订单起始日期:
                </td>
                <td>
                    <asp:TextBox ID="txtTime1" class="easyui-datebox" runat="server"></asp:TextBox>
                </td>
                <td>
                    订单截止日期:
                </td>
                <td>
                    <asp:TextBox ID="txtTime2" class="easyui-datebox" runat="server"></asp:TextBox>
                    <asp:Button ID="Button1" style="display:none;"  runat="server" Text="Button" 
                        onclick="Button1_Click" />
                </td>
                <td>会员卡号</td><td>
                <asp:TextBox ID="txtDZ" runat="server"></asp:TextBox>
                </td>
                <td>
                    会员姓名:
                </td>
                <td>
                    <asp:TextBox ID="txtJT" runat="server"></asp:TextBox>
                </td>
                <td rowspan="2">
                    <a class="easyui-linkbutton" onclick="btnSearch2()">查询</a>
                    <a class="easyui-linkbutton" onclick="btnSearch()">导出Excel</a>
                </td>
            </tr>
            <tr>
            <td>订单状态:</td>
            <td>
                <asp:DropDownList ID="DropDownList1" runat="server">
                    <asp:ListItem Value="0">全部</asp:ListItem>
                    <asp:ListItem Value="1">已下单</asp:ListItem>
                    <asp:ListItem Value="3">已备货</asp:ListItem>
                    <asp:ListItem Value="2">已发货</asp:ListItem>
                    <asp:ListItem Value="4">已收货</asp:ListItem>
                </asp:DropDownList>
                </td>
                <td>礼品所需积分:</td><td>
                    <asp:TextBox ID="txtJF" runat="server"></asp:TextBox>
                </td>
                <td>会员手机</td>
                <td>
                    <asp:TextBox ID="txtDY" runat="server"></asp:TextBox>
                </td>
                 <td>
                     所属品牌:
                </td>
                <td>
                    <asp:TextBox ID="txtMD" runat="server"></asp:TextBox>
                </td>
            </tr>
        </table>
    </div>
    <div>
        <table id="grid">
        </table>
        <div id="mm" class="easyui-menu" style="width: 120px;">
        <%--<div onclick="Delete1()" iconcls="icon-add">
                已备货</div>
            <div onclick="Delete()" iconcls="icon-add">
                已发货</div>
                <div onclick="Delete2()" iconcls="icon-add">
                已收货</div>--%>
        </div>
    </div>
    </form>
</body>
</html>
<script type="text/javascript">
    function btnSearch2() {

        $('#grid').datagrid('load', {
            time1: $("#txtTime1").datebox("getValue"),
            time2: $("#txtTime2").datebox("getValue"),
            text: $("#DropDownList1").val(),
            jf: $("#txtJF").val(),
            dz: $("#txtDZ").val(),
            dy: $("#txtDY").val(),
            jt: $("#txtJT").val(),
            md: $("#txtMD").val()
        });
</script>

